As is well known in the art, a watch dog timer is timer circuitry which is designed to reset a real-time system if a predetermined time period ("time-out") has expired prior to the timer's being reset. In a typical real-time system, the function of a watch dog timer is to reset the real-time system whenever a malfunction occurs and, thereby, to prevent the system from crashing. Such malfunctions are typically caused by infinite loops in the operating system.
As is well known, in order to accomplish the above-described objective, a watch dog task in a multi-task, real-time system is assigned the job of "patting" the watch dog timer. The term "patting" the watch dog timer refers to the function of resetting the watch dog timer prior to its reaching the predetermined time-out. As is well known, whenever the watch dog timer is reset, it is, thereby, prevented from resetting the real-time system by, for example, causing a power boot-up. As is also well known, in order to assure that the watch dog task will "pat" the watch dog timer prior to its reaching the predetermined time-out, the watch dog task is typically a relatively high priority task with respect to applications tasks which are also executing in the multi-task, real-time system.
As is well known to those of ordinary skill in the art, infinite loops occur in a typical real-time system. However, certain types of infinite loops are planned and are, therefore, desired whereas other types of infinite loops are unplanned and are, therefore, undesired. For example, an example of a planned infinite loop in a real-time system occurs in response to a real event. Specifically, a real event corresponds to a physical event such as, for example, a timer tick, a disk access and so forth. As a consequence, a real-time system typically contains infinite real event loops which are planned infinite loops. Such infinite loops are usually suspended while they are waiting for a real event to occur.
In contrast to the real event infinite loops described above, there are unplanned infinite loops which are undesirable in a real-time system. One example of such an undesired infinite tight loop is a loop in a real-time task which never terminates and which does not suspend to wait for, for example, a real event. As a consequence, such a task is always ready to execute. Another example of such an undesired infinite loop is an infinite inter-task loop. An infinite inter-task loop is a loop between several tasks which never terminates and which does not suspend to wait for, for example, a real event. Specifically, one example of an infinite inter-task loop is understood in the context of a simple example as follows. Assume that: (a) task A sends a message to task B; (b) task B sends the message to task C; and (c) task C sends the message back to task A. As one can readily appreciate, this cycle will repeat itself forever and will result in one of the tasks, i.e., task A, task B, or task C, always being ready to execute.
Watch dog timers which are used in prior art systems only catch infinite tight loops which occur in the operating system of a multi-task, real-time system. Thus, if the real-time system continues to service interrupts and dispatch tasks, despite the presence of an infinite tight loop in the operating system, the watch dog timer will not be triggered. Further, this will occur, despite the fact that application tasks are looping and, therefore, not providing the intended service. As one can readily appreciate, this is a serious problem in real-time systems where continuous service is important. Further, this is more serious than a problem which results in a crash because most real-time systems are designed to restart automatically after a crash and, as such, service would be resumed.
As one can readily appreciate, there is a need in the art for a method and apparatus for detecting infinite tight loops and infinite inter-task loops in application tasks in a multi-task, real-time system.